<template>
  <div class="settings-container">
    <!-- 个性化设置页面内容 -->
    <div class="settings-content">
      <div class="settings-header">
        <h2>{{ $t('personalizationSettings') }}</h2>
        <p>{{ $t('personalizationContent') }}</p>
      </div>
      
      <div class="settings-section">
        <h3>{{ $t('themeSwitch') }}</h3>
        <div class="theme-options">
          <button class="theme-button" @click="toggleTheme('light')">
            <i class="el-icon-sunny"></i> {{ $t('lightMode') }}
          </button>
          <button class="theme-button" @click="toggleTheme('dark')">
            <i class="el-icon-moon"></i> {{ $t('darkMode') }}
          </button>
        </div>
      </div>
      
      <div class="settings-section">
        <h3>{{ $t('languageSelection') }}</h3>
        <div class="language-options">
          <button class="language-button" @click="changeLanguage('zh')">
            <i class="el-icon-chat-dot-round"></i> {{ $t('chinese') }}
          </button>
          <button class="language-button" @click="changeLanguage('en')">
            <i class="el-icon-chat-line-round"></i> {{ $t('english') }}
          </button>
        </div>
      </div>
      
      <div class="save-button" @click="saveSettings">
        {{ $t('saveSettings') }}
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      isDarkMode: false,
      notifications: {
        system: true,
        interaction: true,
        service: true
      },
      currentLanguage: 'zh'
    };
  },
  methods: {
    toggleTheme(mode) {
      this.isDarkMode = mode === 'dark';
      document.body.classList.toggle('dark-mode', this.isDarkMode);
    },
    changeLanguage(lang) {
      this.$i18n.locale = lang;
      this.currentLanguage = lang;
      localStorage.setItem('appLanguage', lang);
    },
    saveSettings() {
      alert(this.$t('settingsSaved'));
    }
  },
  created() {
    const savedLanguage = localStorage.getItem('appLanguage');
    if (savedLanguage) {
      this.$i18n.locale = savedLanguage;
      this.currentLanguage = savedLanguage;
    }
  }
};
</script>

<style scoped>
/* 全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
  background-color: #f5f7fa;
  color: #333;
  line-height: 1.6;
}

.dark-mode {
  background-color: #1a1a1a;
  color: #f0f0f0;
}

/* 主容器样式 - 与反馈页面一致 */
.settings-container {
  max-width: 800px;
  margin: 2rem auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(74, 175, 254, 0.1);
  padding: 30px;
  border: 1px solid #e3f2fd;
  position: relative;
  overflow: hidden;
}

.settings-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, #4f8bf9, #2ac9e6);
}

.dark-mode .settings-container {
  background-color: #2d2d2d;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* 欢迎语样式 - 与反馈页面一致 */
.settings-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px;
  background: linear-gradient(135deg, 
    white 0%, 
    white 30%,  
    #3e92cc 60%, 
    #3e92cc 100%
  );
  border-radius: 10px;
}

.settings-header h2 {
  font-size: 28px;
  color: #2c3e50;
  margin-bottom: 10px;
  position: relative;
  display: inline-block;
}

.settings-header h2::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: #4f8bf9;
  transform: scaleX(0);
  transition: transform 0.3s;
}

.settings-header h2:hover::after {
  transform: scaleX(1);
}

.settings-header p {
  font-size: 16px;
  color: white;
}

/* 设置区块样式 - 与反馈页面一致 */
.settings-section {
  margin-bottom: 30px;
  background-color: #f9f9f9;
  border-radius: 10px;
  padding: 25px;
  border: 1px solid #e3f2fd;
  transition: transform 0.3s, box-shadow 0.3s;
}

.settings-section:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.dark-mode .settings-section {
  background-color: #3a3a3a;
}

.settings-section h3 {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  font-size: 20px;
  color: #2c3e50;
  position: relative;
  padding-left: 15px;
}

.settings-section h3::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 5px;
  height: 25px;
  background-color: #4f8bf9;
  border-radius: 3px;
}

.dark-mode .settings-section h3 {
  color: #f0f0f0;
}

/* 按钮组样式 - 与反馈页面一致 */
.theme-options,
.notification-options,
.album-options,
.language-options {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
}

.theme-button,
.notification-button,
.album-button,
.language-button {
  flex: 1;
  min-width: 120px;
  padding: 12px;
  background-color: #f0f4ff;
  border: 1px solid #e3f2fd;
  border-radius: 8px;
  color: #4f8bf9;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.theme-button:hover,
.notification-button:hover,
.album-button:hover,
.language-button:hover {
  background-color: #e1ecff;
}

.theme-button.active,
.notification-button.active,
.album-button.active,
.language-button.active {
  background-color: #4f8bf9;
  color: white;
  border-color: #4f8bf9;
}

/* 保存按钮样式 - 与反馈页面一致 */
.save-button {
  width: 100%;
  padding: 15px;
  background-color: #4f8bf9;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.save-button:hover {
  background-color: #3a7ae8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(108, 92, 231, 0.3);
}

.save-button:disabled {
  background-color: #b3c6ff;
  cursor: not-allowed;
}

.save-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transition: transform 0.5s;
}

.save-button:hover::before {
  left: 100%;
}

/* 响应式设计 - 与反馈页面一致 */
@media (max-width: 768px) {
  .settings-container {
    margin: 20px;
    padding: 20px;
  }
  
  .settings-header h2 {
    font-size: 24px;
  }
  
  .settings-section h3 {
    font-size: 18px;
  }
  
  .theme-options,
  .notification-options,
  .album-options,
  .language-options {
    flex-direction: column;
  }
  
  .theme-button,
  .notification-button,
  .album-button,
  .language-button {
    width: 100%;
  }
  .theme-button i,
  .language-button i {
    margin-right: 8px;
    font-size: 18px;
  }
}
</style>